using System;

namespace ECCIT.Data
{
	/// <summary>
	///		ColumnFactory is the static factory class of ECCIT.Data.Column class
	/// </summary>
	public class ColumnFactory
	{
		/// <summary>
		///		Create a IColumn instance with DataType and column name
		/// </summary>
		/// <param name="type">DataType enum value</param>
		/// <param name="name">The column name</param>
		/// <returns></returns>
		public static IColumn CreateColumn(string name, DataType type)
		{
			return new Column(type, name);
		}

		/// <summary>
		///		Create a IColumn instance with DataType, column name and column length,
		///		this method is only fit for DataType.String enum value
		/// </summary>
		/// <param name="type">DataType enum value</param>
		/// <param name="name">The column name</param>
		/// <param name="length">The column length</param>
		/// <returns></returns>
		public static IColumn CreateColumn(string name, DataType type, int length)
		{
			return new Column(type, name, length);
		}

		/// <summary>
		///		Create a IColumn instance with DataType, column name, column precision and column scale,
		///		this method is only fit for DataType.Decimal enum value
		/// </summary>
		/// <param name="type">DataType enum value</param>
		/// <param name="name">The column name</param>
		/// <param name="precision">The column precision</param>
		/// <param name="scale">The column scale</param>
		/// <returns></returns>
		public static IColumn CreateColumn(string name, DataType type, int precision, int scale)
		{
			return new Column(type, name, precision, scale);
		}

		/// <summary>
		///		Create a IColumn instance which is fit for GUID
		/// </summary>
		/// <param name="name">The column name</param>
		/// <returns></returns>
		public static IColumn CreateGuidColumn(string name)
		{
			return new Column(DataType.Guid, name);
		}
		
		public static IColumn CreateColumn(string name, DataType type, bool nullable)
		{
			return new Column(type, name, nullable);
		}

        public static IColumn CreateDateColumn(string name, bool nullable)
        {
            return new Column(DataType.Date, name, 10, nullable);
        }

        public static IColumn CreateDateTimeColumn(string name, bool nullable)
        {
            return new Column(DataType.DateTime, name, 19, nullable);
        }
	}
}
